package lambda;

import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import utils.MobileUtil;
import utils.StringUtils;

import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

public class MapTest {

    public static void main(String[] args) {

        List<String> list = Lists.newArrayList();
        list.add("400-123456789");
        list.add("800-123456789");
        list.add("86123456789");
        list.add("");
        list.add("(020)123456");
        list.add("()---");
        list = list.stream()
                .filter(p -> !StringUtils.isNullOrEmpty(p))
                .map(p -> MobileUtil.filterPhone(p))
                .map(p -> MobileUtil.filterPrefix86(p))
                .filter(p -> !StringUtils.isNullOrEmpty(p))
                .filter(p -> !p.startsWith("400") && !p.startsWith("800"))
                .collect(Collectors.toList());
        //list.forEach(p-> System.out.println(p));




        String ids = "1,1,2,,43,,,4,5,6,,";
        Set<String> userIdSet = Sets.newHashSet(ids.split(","));
        List<String> userIdList = userIdSet.stream().filter(p->!StringUtils.isNullOrEmpty(p)).collect(Collectors.toList());
        userIdList.forEach(p-> System.out.println(p));
    }
}
